import React, {Component} from 'react'

class App extends Component {
    render(){
      return(
        <div>
          app组件
          <A render={(name) => <B name={name}/>}/>
        </div>
      )
    }
}

class A extends Component {
	  state = {name:'tom'}
    render() {
        console.log(this.props);
        const {name} = this.state
        return (
          <div>
            <h1>我是A组件</h1>
            {this.props.render(name)}
          </div>
        )
    }
}

function B(props){
  const {name} = props
   return(
    <h2>函数式B组件，接收A组件的参数<span style={{color:'red'}}>{name}</span></h2>
   )
}

export default App